package com.ruoyi.draw.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.draw.mapper.NovelTypeMapper;
import com.ruoyi.draw.domain.NovelType;
import com.ruoyi.draw.service.INovelTypeService;

/**
 * NovelTypeService业务层处理
 * 
 * @author Locek
 * @date 2025-10-25
 */
@Service
public class NovelTypeServiceImpl implements INovelTypeService 
{
    @Autowired
    private NovelTypeMapper novelTypeMapper;

    /**
     * 查询NovelType
     * 
     * @param id NovelType主键
     * @return NovelType
     */
    @Override
    public NovelType selectNovelTypeById(Long id)
    {
        return novelTypeMapper.selectNovelTypeById(id);
    }

    /**
     * 查询NovelType列表
     * 
     * @param novelType NovelType
     * @return NovelType
     */
    @Override
    public List<NovelType> selectNovelTypeList(NovelType novelType)
    {
        return novelTypeMapper.selectNovelTypeList(novelType);
    }

    /**
     * 新增NovelType
     * 
     * @param novelType NovelType
     * @return 结果
     */
    @Override
    public int insertNovelType(NovelType novelType)
    {
        novelType.setId(System.currentTimeMillis());
        novelType.setCreateBy(SecurityUtils.getUsername());
        novelType.setCreateTime(DateUtils.getNowDate());
        return novelTypeMapper.insertNovelType(novelType);
    }

    /**
     * 修改NovelType
     * 
     * @param novelType NovelType
     * @return 结果
     */
    @Override
    public int updateNovelType(NovelType novelType)
    {
        novelType.setUpdateBy(SecurityUtils.getUsername());
        novelType.setUpdateTime(DateUtils.getNowDate());
        return novelTypeMapper.updateNovelType(novelType);
    }

    /**
     * 批量删除NovelType
     * 
     * @param ids 需要删除的NovelType主键
     * @return 结果
     */
    @Override
    public int deleteNovelTypeByIds(Long[] ids)
    {
        return novelTypeMapper.deleteNovelTypeByIds(ids);
    }

    /**
     * 删除NovelType信息
     * 
     * @param id NovelType主键
     * @return 结果
     */
    @Override
    public int deleteNovelTypeById(Long id)
    {
        return novelTypeMapper.deleteNovelTypeById(id);
    }
}
